package business;

import java.sql.Connection;
import java.sql.DriverManager;
import java.util.HashMap;

import javax.swing.JOptionPane;

import model.ConectBanco;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;

public class Relatorios {
	
	public JasperPrint alunoPorCurso() throws Exception{
		JasperPrint rel = null;
		try {
	        Connection con = new ConectBanco().getConexao();
			HashMap  map = new HashMap();
			map.put("","");
			String arquivoJasper = "src/file/alunocurso.jasper";
			rel = JasperFillManager.fillReport(arquivoJasper, map, con);
		} catch (JRException e) {
			JOptionPane.showMessageDialog(null,e.getMessage());
		}
		return rel;
	}
	
	public JasperPrint disciplinaPorCurso() throws Exception{
		JasperPrint rel = null;
		try {
	        Connection con = new ConectBanco().getConexao();
			HashMap  map = new HashMap();
			map.put("","");
			String arquivoJasper = "src/file/DISCIPLINA.jasper";
			rel = JasperFillManager.fillReport(arquivoJasper, map, con);
		} catch (JRException e) {
			JOptionPane.showMessageDialog(null,e.getMessage());
		}
		return rel;
	}

	public JasperPrint professorPorCurso() throws Exception{
		JasperPrint rel = null;
		try {
	        Connection con = new ConectBanco().getConexao();
			HashMap  map = new HashMap();
			map.put("","");
			String arquivoJasper = "src/file/PROFESSORCURSO.jasper";
			rel = JasperFillManager.fillReport(arquivoJasper, map, con);
		} catch (JRException e) {
			JOptionPane.showMessageDialog(null,e.getMessage());
		}
		return rel;
	}
	public JasperPrint cursoPorDisciplina() throws Exception{
		JasperPrint rel = null;
		try {
	        Connection con = new ConectBanco().getConexao();
			HashMap  map = new HashMap();
			map.put("","");
			String arquivoJasper = "src/file/CURSO.jasper";
			rel = JasperFillManager.fillReport(arquivoJasper, map, con);
		} catch (JRException e) {
			JOptionPane.showMessageDialog(null,e.getMessage());
		}
		return rel;
	}
}
